package com.easy.slurm.controller;

import com.easy.slurm.slurm.api.SlurmApi;
import com.easy.slurm.slurm.bean.FileUpload;
import com.easy.slurm.slurm.bean.SbatchJobSubmit;
import com.easy.slurm.vo.ResultVo;
import com.jcraft.jsch.JSchException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

/**
 * @author bing.bai
 * @create 2025/6/12
 */
@Slf4j
@RestController
@RequestMapping("slurm/file")
public class FileController {


    @Autowired
    private SlurmApi slurmApi;

    /**
     * 上传作业文件
     * @param fileUpload
     * @return
     * @throws JSchException
     * @throws IOException
     */
    @PostMapping("/uploadFile")
    public ResultVo uploadFile(FileUpload fileUpload) throws JSchException, IOException {
        return slurmApi.uploadFile(fileUpload);
    }


}
